package com.nodecollege.cloud.controller;

import com.nodecollege.cloud.common.model.NCResult;
import com.nodecollege.cloud.common.model.vo.SendMailVO;
import com.nodecollege.cloud.service.MailSendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author LC
 * @date 2021/1/21 15:15
 */
@RestController
@RequestMapping("/mail")
public class MailController {

    @Autowired
    private MailSendService mailSendService;

    @PostMapping("/sendMail")
    public NCResult sendMail(@RequestBody SendMailVO sendMailVO) {
        mailSendService.sendEmail(sendMailVO.getToMail(), sendMailVO.getTitle(), sendMailVO.getContent());
        return NCResult.ok();
    }
}
